//
//  SortTableViewCell.m
//  Menu
//
//  Created by Lynn-Shin on 15/7/6.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "SortTableViewCell.h"

@implementation SortTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    
//    self.isDid = YES;
    
    self.titleImage = [[UIImageView alloc] initWithFrame:CGRectMake(8*WIDTH, 5*HEIGHT, 70*WIDTH, 70*HEIGHT)];
//        self.titleImage.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.titleImage];
    [self.titleImage release];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(80*WIDTH, 10*HEIGHT, 150*WIDTH, 40*HEIGHT)];
//        self.nameLabel.backgroundColor = [UIColor lightGrayColor];
    self.nameLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel release];
    
    UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, 59*HEIGHT, WIDTH, 1)];
    line.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:line];
    [line release];
    
    self.arrowImage = [[UIImageView alloc] initWithFrame:CGRectMake(320*WIDTH, 15*HEIGHT, 30*WIDTH, 30*HEIGHT)];
//    self.arrowImage.backgroundColor = [UIColor redColor];
    self.arrowImage.image = [UIImage imageNamed:@"baritem_left_normal"];
    [self.contentView addSubview:self.arrowImage];
    [self.arrowImage release];
    
}

-(void)setSortModel:(SortModel *)sortModel{
    
    if (_sortModel != sortModel) {
        [_sortModel release];
        _sortModel = [sortModel retain];
    }
    [self.titleImage sd_setImageWithURL:[NSURL URLWithString:sortModel.imagePath]];
    self.nameLabel.text = sortModel.name;
}

//-(void)layoutSubviews{
//    
//    [super layoutSubviews];
//    [self.titleImage sd_setImageWithURL:[NSURL URLWithString:self.sortModel.imagePath]];
//     self.nameLabel.text = self.sortModel.name;
//}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
